package com.example.demo.controller;

import com.example.demo.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DemoController {

    @Autowired
    private DemoService demoService;

    /**
     * 本工程接口
     * @return
     */
    @GetMapping(value = "/user1/test1")
    public String test1() {
        return "this is service-user1 service test1 method";
    }

    /**
     * 调用service-user2服务接口
     * @return
     */
    @GetMapping(value = "/user1/test2")
    public String test2() {
        return demoService.user2test2();
    }

    /**
     * 调用service-user2服务接口，验证熔断功能
     * @return
     */
    @RequestMapping(value = "/user1/test3")
    public String test3() {
        return demoService.user2test3();
    }

}
